home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / gnu / gcctest / tests05.zoo / ansidecl.h next >
C/C++ Source or Header  |  1992-03-28  |  3KB  |  109 lines

  1. /* Copyright (C) 1991 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3.  
  4. The GNU C Library is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 1, or (at your option)
  7. any later version.
  8.  
  9. The GNU C Library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12. GNU General Public License for more details.
  13.  
  14. You should have received a copy of the GNU General Public License
  15. along with the GNU C Library; see the file COPYING.  If not, write to
  16. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  17.  
  18. /* ANSI and traditional C compatibility macros
  19.  
  20.    ANSI C is assumed if __STDC__ is #defined.
  21.  
  22.    Macro    ANSI C definition    Traditional C definition
  23.    -----    ---- - ----------    ----------- - ----------
  24.    PTR        `void *'        `char *'
  25.    LONG_DOUBLE    `long double'        `double'
  26.    CONST    `const'            `'
  27.    VOLATILE    `volatile'        `'
  28.    SIGNED    `signed'        `'
  29.    PTRCONST    `void *const'        `char *'
  30.  
  31.    DEFUN(name, arglist, args)
  32.  
  33.     Defines function NAME.
  34.  
  35.     ARGLIST lists the arguments, separated by commas and enclosed in
  36.     parentheses.  ARGLIST becomes the argument list in traditional C.
  37.  
  38.     ARGS list the arguments with their types.  It becomes a prototype in
  39.     ANSI C, and the type declarations in traditional C.  Arguments should
  40.     be separated with `AND'.  For functions with a variable number of
  41.     arguments, the last thing listed should be `DOTS'.
  42.  
  43.    DEFUN_VOID(name)
  44.  
  45.     Defines a function NAME, which takes no arguments.
  46.  
  47.    EXFUN(name, prototype)
  48.  
  49.     Is used in an external function declaration.
  50.     In ANSI C it is `NAMEPROTOTYPE' (so PROTOTYPE should be enclosed in
  51.     parentheses).  In traditional C it is `NAME()'.
  52.     For a function that takes no arguments, PROTOTYPE should be `(NOARGS)'.
  53.  
  54.     For example:
  55.     extern int EXFUN(printf, (CONST char *format DOTS));
  56.     int DEFUN(fprintf, (stream, format),
  57.           FILE *stream AND CONST char *format DOTS) { ... }
  58.     void DEFUN_VOID(abort) { ... }
  59. */
  60.  
  61. #ifndef    _ANSIDECL_H
  62.  
  63. #define    _ANSIDECL_H    1
  64.  
  65.  
  66. /* Every source file includes this file,
  67.    so they will all get the switch for lint.  */
  68. /* LINTLIBRARY */
  69.  
  70.  
  71. #if    __STDC__
  72.  
  73. #define    PTR        void *
  74. #define    PTRCONST    void *CONST
  75. #define    LONG_DOUBLE    long double
  76.  
  77. #define    AND        ,
  78. #define    NOARGS        void
  79. #define    CONST        const
  80. #define    VOLATILE    volatile
  81. #define    SIGNED        signed
  82. #define    DOTS        , ...
  83.  
  84. #define    EXFUN(name, proto)        name proto
  85. #define    DEFUN(name, arglist, args)    name(args)
  86. #define    DEFUN_VOID(name)        name(NOARGS)
  87.  
  88. #else    /* Not ANSI C.  */
  89.  
  90. #define    PTR        char *
  91. #define    PTRCONST    PTR
  92. #define    LONG_DOUBLE    double
  93.  
  94. #define    AND        ;
  95. #define    NOARGS
  96. #define    CONST
  97. #define    VOLATILE
  98. #define    SIGNED
  99. #define    DOTS
  100.  
  101. #define    EXFUN(name, proto)        name()
  102. #define    DEFUN(name, arglist, args)    name arglist args;
  103. #define    DEFUN_VOID(name)        name()
  104.  
  105. #endif    /* ANSI C.  */
  106.  
  107.  
  108. #endif    /* ansidecl.h    */
  109.